Micron Document
`:top
`!`B100`F9d9cd`f`b`! is a `F33f`_`[shell`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Shell_(computing)]`_`f `F33f`_`[command`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Command_(computing)]`_`f that changes the `F33f`_`[working directory`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Working_directory]`_`f. It is available in many shells and other `F33f`_`[applications`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Application_software]`_`f that maintain a working directory. In some contexts, the command can perform actions other than change directory. Some environments provide the change directory feature via a different command name such as `B100`F9d9chdir`f`b.

>>Contents

• `F0af`_`[Implementations`#implementations]`_`f
• `F0af`_`[Use`#use]`_`f
• `F0af`_`[Common`#common]`_`f
• `F0af`_`[Unix shells`#unix-shells]`_`f
• `F0af`_`[Legacy Microsoft shells`#legacy-microsoft-shells]`_`f
• `F0af`_`[Example`#example]`_`f
• `F0af`_`[See also`#see-also]`_`f
• `F0af`_`[References`#references]`_`f
• `F0af`_`[Further reading`#further-reading]`_`f
• `F0af`_`[External links`#external-links]`_`f

-─

>>Implementations

Generally, a computer system that provides access to a `F33f`_`[hierarchical file system`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Hierarchical_file_system]`_`f, provides a change directory command to set the working directory. As this applies to most operating system shells, most support a change directory command, including `F33f`_`[Unix`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Unix]`_`f and `F33f`_`[Unix-like`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Unix-like]`_`f (i.e. `F33f`_`[Linux`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Linux]`_`f) `F33f`_`[shells`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Unix_shell]`_`f, and `F33f`_`[Microsoft`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Microsoft]`_`f shells including `F33f`_`[Command Prompt`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Command_Prompt]`_`f and `F33f`_`[PowerShell`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=PowerShell]`_`f.

Other operating systems with shells supporting the command include `F33f`_`[OS/2`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=OS/2]`_`f,`:cite-ref-1[`F5bf`_`[1`#cite-note-1]`_`f] `F33f`_`[TRIPOS`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=TRIPOS]`_`f,`:cite-ref-2[`F5bf`_`[2`#cite-note-2]`_`f] `F33f`_`[AmigaOS`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=AmigaOS]`_`f`:cite-ref-3[`F5bf`_`[3`#cite-note-3]`_`f] (where the command is implied for an input `F33f`_`[path`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Path_(computing)]`_`f), `F33f`_`[ReactOS`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=ReactOS]`_`f,`:cite-ref-4[`F5bf`_`[4`#cite-note-4]`_`f] `F33f`_`[DOSBox`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=DOSBox]`_`f, and `F33f`_`[UEFI`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Unified_Extensible_Firmware_Interface]`_`f.`:cite-ref-efi-shells-and-scripting-5-0[`F5bf`_`[5`#cite-note-efi-shells-and-scripting-5]`_`f]

• On `F33f`_`[MS-DOS`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=MS-DOS]`_`f, the command is available in version 2 and later`:cite-ref-runningmsdos-6-0[`F5bf`_`[6`#cite-note-runningmsdos-6]`_`f]
• `F33f`_`[DR DOS 6.0`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=DR_DOS_6.0]`_`f includes the command as both `B100`F9d9cd`f`b and `B100`F9d9chdir`f`b`:cite-ref-drdos6userguide-7-0[`F5bf`_`[7`#cite-note-drdos6userguide-7]`_`f]
• On `F33f`_`[HP`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Hewlett-Packard]`_`f `F33f`_`[MPE/iX`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=HP_Multi-Programming_Executive]`_`f the command is `B100`F9d9chdir`f`b`:cite-ref-8[`F5bf`_`[8`#cite-note-8]`_`f]
• On `F33f`_`[OpenVOS`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Stratus_VOS]`_`f, the command is `B100`F9d9change_current_dir`f`b`:cite-ref-9[`F5bf`_`[9`#cite-note-9]`_`f]

Unlike many shell commands that are implemented as separate `F33f`_`[applications`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Application_software]`_`f, change directory is often built-in to the shell because it affects the `F33f`_`[state`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=State_(computer_science)]`_`f of the shell whereas other commands modify system state outside the shell. If the command was implemented as a separate application, then the `F33f`_`[child process`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Child_process]`_`f would need to modify state in the `F33f`_`[parent process`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Parent_process]`_`f, but this is often prevented for safety. The command is built-in for most Unix shells (`F33f`_`[Bourne`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Bourne_shell]`_`f, `F33f`_`[tcsh`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Tcsh]`_`f, `F33f`_`[Bash`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Bash_(Unix_shell)]`_`f, etc.), Windows `F33f`_`[Command Prompt`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Command_Prompt]`_`f and `F33f`_`[PowerShell`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=PowerShell]`_`f, and MS-DOS `F33f`_`[COMMAND.COM`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=COMMAND.COM]`_`f.

In a shell, the change directory command is typically implemented via a `F33f`_`[system call`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=System_call]`_`f which on Unix and Unix-like systems is typically `F33f`_`[POSIX`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=POSIX]`_`f `B100`F9d9chdir()`f`b and on Windows is in the `F33f`_`[Windows API`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Windows_API]`_`f.

The command is also provided in many programs other than shells. In the `F33f`_`[File Transfer Protocol`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=File_Transfer_Protocol]`_`f, the control stream command is `B100`F9d9CWD`f`b, but the functionality is available as `B100`F9d9cd`f`b in most command-line `F33f`_`[clients`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Client_(computing)]`_`f and some also provide `B100`F9d9lcd`f`b for changing the local working directory vs. the remote setting. The `F33f`_`[numerical computing`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Numerical_analysis]`_`f environments `F33f`_`[MATLAB`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=MATLAB]`_`f and `F33f`_`[GNU Octave`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=GNU_Octave]`_`f include a change directory command as `B100`F9d9cd`f`b.`:cite-ref-10[`F5bf`_`[10`#cite-note-10]`_`f]`:cite-ref-11[`F5bf`_`[11`#cite-note-11]`_`f]

>>Use

Use of the command varies by context, but there are widespread similarities among variants. The examples below, mostly apply to Unix and Unix-like shells, PowerShell and Command Prompt.

To separate the directory names of a path, a program imposes command-line syntax such as a delimiting text between names – which varies by program. In particular, Unix and Unix-like shells use a forward slash `B100`F9d9/`f`b, Command Prompt uses backslash `B100`F9d9\\`f`b and PowerShell supports either. For simplicity, paths are shown with forward slashes here.

Commonly, a dot is short-hand notation for the working directory and two dots is short-hand for its parent. For example, given working directory `B100`F9d9/user/bin/tmp`f`b, `B100`F9d9.`f`b refers to it and `B100`F9d9..`f`b refers to `B100`F9d9/user/bin`f`b. The parent notation is often used to form a relative path that specifies a path that is both up and down the hierarchy. For example: starting with `B100`F9d9/usr/bin/tmp`f`b, `B100`F9d9cd ../../local`f`b specifies path `B100`F9d9/usr/local`f`b.

>>>Common

Features that are commonly found for any change directory command:

• `B100`F9d9cd path/to/dir`f`b For a relative path (no leading slash), the path is appended to the working directory path; moving the context deeper into the directory tree hierarchy; for example, if the working directory is `B100`F9d9/usr`f`b, then `B100`F9d9cd bin`f`b changes the working directory to `B100`F9d9/usr/bin`f`b
• `B100`F9d9cd /path/to/dir`f`b For an absolute path (leading slash), the working directory is replaced with the specified path; for example, `B100`F9d9cd /bin`f`b sets the working directory to `B100`F9d9/bin`f`b
• `B100`F9d9cd ..`f`b Moves the directory tree context up one directory; for example, starting at `B100`F9d9/usr/bin/tmp`f`b, `B100`F9d9cd ..`f`b changes the working directory to `B100`F9d9/usr/bin`f`b
• `B100`F9d9cd .`f`b Does not change the working directory but is useful to recover after a directory is recreated by another process
• `B100`F9d9cd`f`b With no arguments, the command changes the working directory to the user's home directory; exception: Command Prompt reports the working directory path

>>>Unix shells

Unix-based shells and PowerShell generally share these features:

• `B100`F9d9cd ~`f`b Changes the working directory to user's home directory
• `B100`F9d9cd ~`*username`*`f`b Changes the working directory to the specified user's home directory
• `B100`F9d9cd -`f`b Changes the working directory to the previous directory; for example, starting at `B100`F9d9/usr/bin/tmp`f`b, then `B100`F9d9cd /etc`f`b, and then `B100`F9d9cd -`f`b returns to `B100`F9d9/usr/bin/tmp`f`b; this supports toggling between two directories without `F33f`_`[pushd and popd`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Pushd_and_popd]`_`f

>>>Legacy Microsoft shells

DOS maintains separate working directories for each `F33f`_`[lettered drive`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Drive_letter_assignment]`_`f, and also has the concept of a current working drive. The `B100`F9d9cd`f`b command can be used to change the working directory of the working drive or another lettered drive. Typing the drive letter as a command on its own changes the working drive, e.g. `B100`F9d9C:`f`b; alternatively, `B100`F9d9cd`f`b with the `B100`F9d9/d`f`b switch may be used to change the working drive and that drive's working directory in one step. Modern versions of Windows simulate this behaviour for backwards compatibility under `F33f`_`[CMD.EXE`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=CMD.EXE]`_`f.`:cite-ref-12[`F5bf`_`[12`#cite-note-12]`_`f]

>>Example

Starting with working directory set to the user's home (`B100`F9d9~`f`b), command `B100`F9d9`F33f`_`[ls`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Ls]`_`f`f`b followed by `B100`F9d9cd games`f`b might produce the following:

`B100`F9d9user@wikipedia:~$ ls`f`b
`B100`F9d9workreports games encyclopedia text.txt`f`b
`B100`F9d9user@wikipedia:~$ cd games`f`b
`B100`F9d9user@wikipedia:~/games$`f`b

A similar session in Command Prompt might look like:

`B100`F9d9C:\\> dir`f`b
`B100`F9d9workreports <DIR> Wed Oct 9th 9:01`f`b
`B100`F9d9games <DIR> Tue Oct 8th 14:32`f`b
`B100`F9d9encyclopedia <DIR> Mon Oct 1st 10:05`f`b
`B100`F9d9text txt 1903 Thu Oct10th 12:43`f`b
`B100`F9d9C:\\> cd games`f`b
`B100`F9d9C:\\games>`f`b

>>See also

• `F33f`_`[Directory structure`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Directory_structure]`_`f – Hierarchical structure of a computer's file system
• `F33f`_`[chroot`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Chroot]`_`f – Shell command and system call that changes the apparent root directory
• `F33f`_`[List of command-line interpreters`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=List_of_command-line_interpreters]`_`f
• `F33f`_`[pushd and popd`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Pushd_and_popd]`_`f – Shell commands to save and restore the working directory
• `F33f`_`[pwd`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Pwd]`_`f – Shell command that reports the working directory

>>References

`:cite-note-1`!1.`! `F0af`_`[↑`#cite-ref-1]`_`f "JaTomes Help – OS/2 Commands". `*www.jatomes.com`*. Archived from the original on 2019-04-14. Retrieved 2019-08-11.
`:cite-note-2`!2.`! `F0af`_`[↑`#cite-ref-2]`_`f "Introduction to Tripos" (PDF). Retrieved 2020-05-01.
`:cite-note-3`!3.`! `F0af`_`[↑`#cite-ref-3]`_`f `:citerefr-gheimerspanik1988`aRügheimer, Hannes; Spanik, Christian (May 1, 1988). `*AmigaDOS quick reference`*. Grand Rapids, Mi : Abacus. `F33f`_`[ISBN`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=ISBN_(identifier)]`_`f 9781557550491 – via Internet Archive.
`:cite-note-4`!4.`! `F0af`_`[↑`#cite-ref-4]`_`f "Reactos/reactos". `*GitHub`*. 3 January 2022.
`:cite-note-efi-shells-and-scripting-5`!5.`! `F0af`_`[↑`#cite-ref-efi-shells-and-scripting-5-0]`_`f "EFI Shells and Scripting". `F33f`_`[Intel`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Intel]`_`f. Retrieved 2013-09-25.
`:cite-note-runningmsdos-6`!6.`! `F0af`_`[↑`#cite-ref-runningmsdos-6-0]`_`f `:citerefwolverton2003`aWolverton, Van (2003). `*Running MS-DOS Version 6.22 (20th Anniversary Edition), 6th Revised edition`*. `F33f`_`[Microsoft Press`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Microsoft_Press]`_`f. `F33f`_`[ISBN`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=ISBN_(identifier)]`_`f 0-7356-1812-7.
`:cite-note-drdos6userguide-7`!7.`! `F0af`_`[↑`#cite-ref-drdos6userguide-7-0]`_`f "DR DOS 6.0 User Guide Optimisation and Configuration Tips" (PDF). Archived from the original (PDF) on 2019-09-30. Retrieved 2019-08-13.
`:cite-note-8`!8.`! `F0af`_`[↑`#cite-ref-8]`_`f "MPE/iX Command Reference Manual" (PDF). Archived from the original (PDF) on 2018-10-21. Retrieved 2018-10-21.
`:cite-note-9`!9.`! `F0af`_`[↑`#cite-ref-9]`_`f "OpenVOS Commands Reference Manual" (PDF). `*stratadoc.stratus.com`*. Retrieved 2020-09-12.
`:cite-note-10`!10.`! `F0af`_`[↑`#cite-ref-10]`_`f "Change current folder – MATLAB cd". `*www.mathworks.com`*.
`:cite-note-11`!11.`! `F0af`_`[↑`#cite-ref-11]`_`f "Function Reference: cd". `*octave.sourceforge.io`*.
`:cite-note-12`!12.`! `F0af`_`[↑`#cite-ref-12]`_`f "October 11, 2010". `*The Old New Thing`*.

>>Further reading

• `:citerefwolverton1990`aWolverton, Van (1990). `*MS-DOS Commands: Microsoft Quick Reference, 4th Revised edition`*. `F33f`_`[Microsoft Press`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Microsoft_Press]`_`f. `F33f`_`[ISBN`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=ISBN_(identifier)]`_`f 978-1-55615-289-4.
• `:citerefjohn-paul-mueller2007`aJohn Paul Mueller (2007). `*Windows Administration at the Command Line for Windows Vista, Windows 2003, Windows XP, and Windows 2000`*. `F33f`_`[John Wiley & Sons`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Wiley_(publisher)]`_`f. `F33f`_`[ISBN`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=ISBN_(identifier)]`_`f 978-0-470-16579-9.
• `:citerefbarrett2012`aBarrett, Daniel J. (2012). `*Macintosh Terminal Pocket Guide: Take Command of Your Mac`*. `F33f`_`[O'Reilly`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=O'Reilly_Media]`_`f. `F33f`_`[ISBN`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=ISBN_(identifier)]`_`f 978-1-4493-2898-6.

>>External links

Wikibooks has a book on the topic of:

Guide to Windows Commands

The Wikibook

Guide to Unix

has a page on the topic of:

Commands

• Windows XP > Command-line reference A-Z > Chdir (Cd) from `F33f`_`[Microsoft TechNet`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Microsoft_TechNet]`_`f
• `B100`F9d9cd`f`b: change the working directory – Shell and Utilities Reference, `F33f`_`[The Single UNIX Specification`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Single_Unix_Specification]`_`f, Version 5 from `F33f`_`[The Open Group`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=The_Open_Group]`_`f

`c`F0af`_`[↑ Back to top`#top]`_`f`a